package com.yinp.proapp.module.calendar.activity;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.recyclerview.widget.LinearLayoutManager;

import com.yinp.proapp.adapter.ComViewHolder;
import com.yinp.proapp.adapter.CommonAdapter;
import com.yinp.proapp.adapter.SingleViewHolder;
import com.yinp.proapp.base.activity.AppBaseActivity;
import com.yinp.proapp.databinding.ActivityCalendarAddBinding;
import com.yinp.proapp.databinding.ItemWaitDoListBinding;
import com.yinp.proapp.utils.StatusBarUtil;

import java.util.ArrayList;
import java.util.List;

public class CalendarAddActivity extends AppBaseActivity<ActivityCalendarAddBinding> {
    private CommonAdapter<String> waitDoAdapter;
    private List<String> waitDoList = new ArrayList<>();

    @Override
    protected void initViews() {
        setStatusBarHeight(StatusBarUtil.getStatusBarHeight(mContext));
        initClick( bd.header.headerBackImg, bd.header.headerBackTitle, bd.header.ivImg);
        bd.header.headerBackTitle.setText("日历待办");
        bd.tvYear.setText(bd.calendarView.getCurYear() + "-" + bd.calendarView.getCurMonth());
        bd.ctvToday.setText(String.valueOf(bd.calendarView.getCurDay()));
        initRecycler();
    }

    @Override
    public void onClick(View v) {
        super.onClick(v);
        if (v == bd.header.headerBackImg || v == bd.header.headerBackTitle) {
            finish();
        } else if (v == bd.header.ivImg) {//添加

        }
    }

    private void initRecycler() {
        waitDoAdapter = new CommonAdapter<String>(mContext,waitDoList) {
            @Override
            protected SingleViewHolder setComViewHolder(View view, int viewType, ViewGroup parent) {
                return new SingleViewHolder(ItemWaitDoListBinding.inflate(mInflater, parent, false));
            }
        };
        bd.rvWaitDo.setLayoutManager(new LinearLayoutManager(mContext));
        bd.rvWaitDo.setAdapter(waitDoAdapter);
    }
}